
#ifndef __replayH__
#define __replayH__

#include "game.h"
#include "dynamic.h"

namespace WtfEngine {
	class Replay: public virtual IDynamic, public GcObject {
		struct Frame {
			tScalar mGameTime;
			NonCopyBuffer<>::tRef mrFrameUpdate;
		};

		struct FrameBlock: public Frame, public GcObject {
			static const int MaxSubFrames = 32;
			Frame mvSubFrames[MaxSubFrames];

			GC_AUTOSIZE(FrameBlock);
		};

	public:
		typedef std::vector<FrameBlock::tRef> tFrameBlocks;
		typedef enum {
			STOP, PLAY, RECORD
		} tStatus;

	private:
		tFrameBlocks mvFrameBlocks;
		unsigned mCurrentFrame;
		unsigned mNumFrames;

		tGameTime mReplayTime; 
		tGameTime mReplayDelta;
		tStatus mStatus;

	protected:
		void CaptureFrame(tGameTime dt);
		void UpdatePlayback(tGameTime dt);

	public:

		void setStatus(tStatus st);

		tStatus getStatus() const {
			return mStatus;
		};
	
		
		void Navigate(tGameTime time);

		void Update();
	};
};

#endif
